function mainPanel(filterArray) {
	var me = this;
	var mods = master.filter(filterArray.filter);
	var listnumber = 0;
	
	if ( filterArray.group !== undefined ) {
		mods = mods.group(filterArray.group);
	}
	if ( filterArray.sort !== undefined ) {
		mods.sort(filterArray.sort);
	}
	
	this.display = function() {
		$('#mainpanel').html('');
		if ( filterArray.group !== undefined ) {
			for ( x=0; x < mods.length; x++ ) {
				air.trace(mods[x].name);
				$('<h2></h2>').html(mods[x].name).appendTo('#mainpanel');
				me.block(mods[x].mods.mods);
			}
		}
		else {
			me.block(mods.mods);
		}
	};
	
	this.block = function(list, size) {
		if ( size === undefined ) {
			size = 'large';
		}
		
		air.trace(listnumber);
		
		uniqueid = 'creationlist' + listnumber;
		listnumber++;
		
		$('<ul class="creations ' + size + '" id="' + uniqueid + '"></ul>').appendTo('#mainpanel');
		for ( y=0; y < list.length; y++ ) {
			mod = list[y];
			var note = Array();
			var fullnote = Array();
			
			li_id = uniqueid + '-' + mod.json.id;
			$('<li id="' + li_id + '"></li>').appendTo('#' + uniqueid);
			
			var icon = $('<img>').addClass('icon').appendTo('#' + li_id);
			var iconfile = new air.File('app:/images/icons/' + mod.json.type.toLowerCase() + '.jpg');
			if ( iconfile.exists == true ) {
				icon.attr('src', 'file:///' + iconfile.nativePath);
			}
			else {
				icon.attr('src', 'file:///' + air.File.applicationDirectory.resolvePath('images/icons/unknown.jpg').nativePath);
			}
			
			$('<div id="' + li_id +'-download"></div>').addClass('download').appendTo('#' + li_id);
			if ( mod.creation.installed == true ) {
				if ( mod.installed == true ) {
					$('<div></div>').addClass('installed').appendTo('#' + li_id +'-download');
					$('<p></p>').html('Installed').appendTo('#' + li_id +'-download div');
					$('<p class="version"></p>').html('Version ' + mod.json.version).appendTo('#' + li_id +'-download div');
					
					// TODO: Make the link do something
					$('<a href="#"></a>').html('Older versions').appendTo('#' + li_id +'-download');
				}
				else {
					installed = mod.creation.getInstalled();
					$('<div></div>').addClass('outofdate').attr('id', installed.json.id).click(function(){
						id = $(this).attr('id');
						updateVersion(id);
					}).appendTo('#' + li_id +'-download');
					$('<p></p>').html('Out of date').appendTo('#' + li_id +'-download div');
					$('<p class="version"></p>').html('Version ' + installed.json.version).appendTo('#' + li_id +'-download div');
				}
			}
			else {
				$('<div></div>').attr('id', mod.json.id).click(function(){
					id = $(this).attr('id');
					downloadVersion(id);
				}).appendTo('#' + li_id +'-download');
				$('<p></p>').html('Download').appendTo('#' + li_id +'-download div');
				$('<p class="version"></p>').html('Version ' + mod.json.version).appendTo('#' + li_id +'-download div');
				
				// TODO: Make the link do something
				$('<a href="#"></a>').html('Older versions').appendTo('#' + li_id +'-download');
			}
			
			div = li_id + '-div';
			$('<div id="' + div + '"></div>').addClass('content').appendTo('#' + li_id);
			var authors = '';
			if ( mod.creation.json.team.length == 1 ) {
				authors = mod.creation.json.team[0].name;
			}
			else if ( mod.creation.json.team.length == 2 ) {
				authors = mod.creation.json.team[0].name + ' and ' + mod.creation.json.team[1].name;
			}
			else if ( mod.creation.json.team.length > 2 ) {
				// TODO: Make it so 3 authors is allowed
			}
			$('<h1></h1>').html(mod.creation.json.name + ' <small>by ' + authors + '</small>').appendTo('#' + div);
			if ( mod.json.note.length > 150 ) {
				note[li_id] = mod.json.note.substring(0, 150) + '<a href="#" id="' + li_id + '-note-more-link" rel="' + li_id +'">...</a>';
				fullnote[li_id] = mod.json.note
			}
			else {
				note[li_id] = mod.json.note;
				fullnote[li_id] = '';
			}
			$('<p id="' + li_id + '-note"></p>').html(note[li_id]).appendTo('#' + div);
			$('#' + li_id + '-note-more-link').click(function(){
				li_id = $(this).attr('rel');
				$('#' + li_id + '-note').html(fullnote[li_id]);
			});
		}
	};
}



// TODO: Split this crazy long function into nice small bits :)
function showCreations() {
	
}